package com.siyuanren.gcocp.enums.wx;

import org.apache.commons.lang3.StringUtils;

import java.util.Objects;

/**
 * Description
 *
 * @author PVer
 */
public enum ScoreEnum {
    SCORE_REMEDY_CONTENT("补完成课堂内容学习", 1, 2.0),
    SCORE_REMEDY_TASK("补课后作业", 2, 1.0),
    SCORE_CONTENT("完成课堂内容学习", 3, 4.0),
    SCORE_TASK("课后作业", 4, 2.0),
    SCORE_DAY("日全勤", 5, 1.0),
    SCORE_CHALLENGE_DAY("每日挑战", 6, 3.0);

    private String desc;
    private int value;
    private double score;


    ScoreEnum(String desc, int value, double score) {
        this.desc = desc;
        this.value = value;
        this.score = score;
    }

    public static ScoreEnum getModel(int value) {
        for (ScoreEnum he : ScoreEnum.values()) {
            if (Objects.equals(value, he.getValue())) {
                return he;
            }
        }
        return null;
    }

    public static String getEnumDesc(Integer value) {
        if (value == null) {
            return StringUtils.EMPTY;
        }
        ScoreEnum model = getModel(value);
        if (model == null) {
            return StringUtils.EMPTY;
        }
        return model.getDesc();
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    public int getValue() {
        return value;
    }

    public void setValue(int value) {
        this.value = value;
    }
}